﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPageMcSigAdmin.master" AutoEventWireup="true"
    CodeFile="OrdenCargueInternacional.aspx.cs" Inherits="OrdenCargueInternacional" %>

<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxLoadingPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="UsrControls" Namespace="UsrControls" TagPrefix="cc1" %>
<%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <h1 class="presupuesto">
        Orden de Cargue Internacional (MCI)</h1>
    <table border="0" cellpadding="0" cellspacing="0" width="960px">
        <tr>
            <td class="instruccion">
                Para agregar o actualizar la información de una orden de cargue Internacional, por favor complete
                los datos en el formulario y a continuación pulse sobre el botón GRABAR.
            </td>
        </tr>
        <tr>
            <td align="left">
                <asp:ImageButton ID="btnRegresar" runat="server" ImageUrl="~/Images/bt-regresar.gif"
                    OnClick="btnRegresar_Click" CausesValidation="False" />
            </td>
        </tr>
        <tr>
            <td align="left">
                <dx:ASPxLabel runat="server" ID="lblNumeroOrdenCargue" Text="0">
                </dx:ASPxLabel>
                <asp:Label runat="server" ID="lblMensajeAsignarVines"></asp:Label>
                <asp:Label runat="server" ID="lblMensajeLiberarVines"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Width="100%"
                    ForeColor="Black">
                    <asp:TabPanel runat="server" HeaderText="ORDEN DE CARGUE" ID="TabPanel1">
                        <HeaderTemplate>
                            <b>ORDEN DE CARGA INTERNACIONAL</b></HeaderTemplate>
                        <ContentTemplate>
                            <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td colspan="2">
                                        <dx:ASPxCallback ID="ASPxCallback1" runat="server" ClientIDMode="AutoID" ClientInstanceName="Callback">
                                            <ClientSideEvents CallbackComplete="function(s, e) { LoadingPanel.Hide(); }" />
                                        </dx:ASPxCallback>
                                        <dx:ASPxLoadingPanel ID="LoadingPanel" runat="server" ClientIDMode="AutoID" ClientInstanceName="LoadingPanel"
                                            CssPostfix="SoftOrange" ImagePosition="Top" Modal="True" Theme="iOS">
                                            <Image Url="~/App_Themes/SoftOrange/Web/Loading.gif">
                                            </Image>
                                        </dx:ASPxLoadingPanel>
                                        <cc1:msgBox ID="msgBox1" runat="server" />
                                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                            ShowSummary="False" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo-obligatorio" style="width: 25%; height: 24px;">
                                        CABEZOTE ***</td>
                                    <td style="height: 24px; width: 235px;">
                                        <dx:ASPxComboBox ID="ddlCabezote" runat="server" AutoResizeWithContainer="True" IncrementalFilteringMode="Contains"
                                            Theme="PlasticBlue" AutoPostBack="True" 
                                            onselectedindexchanged="ddlCabezote_SelectedIndexChanged">
                                        </dx:ASPxComboBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="ddlCabezote"
                                            ErrorMessage="El campo Cabezote es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo" style="width: 25%; height: 24px;">
                                        TRAILER ***</td>
                                    <td style="height: 24px; width: 235px;">
                                        <dx:ASPxComboBox ID="ddlTrailer" runat="server" AutoResizeWithContainer="True" IncrementalFilteringMode="Contains"
                                            Theme="PlasticBlue">
                                        </dx:ASPxComboBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server" ControlToValidate="ddlTrailer"
                                            ErrorMessage="El campo Trailer es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo" style="width: 25%; height: 24px;">
                                        CONDUCTOR ***</td>
                                    <td style="height: 24px; width: 235px;">
                                        <dx:ASPxComboBox ID="ddlConductores" runat="server" AutoResizeWithContainer="True"
                                            HorizontalAlign="Left" IncrementalFilteringMode="Contains" Theme="PlasticBlue"
                                            Width="50%">
                                        </dx:ASPxComboBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server" ControlToValidate="ddlConductores"
                                            ErrorMessage=" El campo Conductor es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo" style="width: 25%; height: 24px;">
                                        CONDUCTOR AUXILIAR***</td>
                                    <td style="height: 24px; width: 235px;">
                                        <dx:ASPxComboBox ID="ddlConductorAuxiliar" runat="server" AutoResizeWithContainer="True"
                                            HorizontalAlign="Left" IncrementalFilteringMode="Contains" Theme="PlasticBlue"
                                            Width="50%">
                                        </dx:ASPxComboBox>
                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo-obligatorio" runat="server">
                                        REMITENTE
                                    </td>
                                    <td class="size-300" style="width: 235px" runat="server">
                                        <dx:ASPxComboBox ID="ddlZonaOrigen" runat="server" AutoResizeWithContainer="True"
                                            IncrementalFilteringMode="Contains" Theme="PlasticBlue" TextField="Nombre"
                                                         ValueField="ACL_ID_DESTINO"
                                            DataSourceID="SqlDataSourceOrigen">
                                        </dx:ASPxComboBox>
                                        <asp:SqlDataSource ID="SqlDataSourceOrigen" runat="server" 
                                            ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>" 
                                            SelectCommand="SELECT        AUT_CLIENTES.ACL_ID AS ACL_ID_DESTINO, BAS_ZONAS_GEOGRAFICAS.ZON_NOMBRE AS Municipio, 
                         BAS_ZONAS_GEOGRAFICAS_1.ZON_NOMBRE AS Departamento, 
                         AUT_CLIENT.ACT_NOMBRE + ' ' + BAS_ZONAS_GEOGRAFICAS.ZON_NOMBRE + ' ' + ISNULL(AUT_CLIENTES.ACL_RAZON_SOCIAL, '') AS Nombre
FROM            AUT_CLIENTES INNER JOIN
                         BAS_ZONAS_GEOGRAFICAS ON AUT_CLIENTES.ZON_ID = BAS_ZONAS_GEOGRAFICAS.ZON_ID INNER JOIN
                         BAS_ZONAS_GEOGRAFICAS AS BAS_ZONAS_GEOGRAFICAS_1 ON 
                         BAS_ZONAS_GEOGRAFICAS.ZON_PADRE_ID = BAS_ZONAS_GEOGRAFICAS_1.ZON_ID INNER JOIN
                         AUT_CLIENT ON AUT_CLIENTES.ACT_ID = AUT_CLIENT.ACT_ID">
                                        </asp:SqlDataSource>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="ddlZonaOrigen"
                                            ErrorMessage="El campo Cabezote es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo-obligatorio" runat="server">
                                        DESTINATARIO
                                    </td>
                                    <td class="size-300" style="width: 235px" runat="server">
                                        <dx:ASPxComboBox ID="ddlZonaDestino" runat="server" AutoResizeWithContainer="True"
                                            IncrementalFilteringMode="Contains" Theme="PlasticBlue" 
                                            DataSourceID="SqlDataSourceOrigen" TextField="Nombre" 
                                            ValueField="ACL_ID_DESTINO">
                                        </dx:ASPxComboBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" ControlToValidate="ddlZonaDestino"
                                            ErrorMessage="El campo Trailer es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr id="tr3" >
                                    <td class="campo-obligatorio" runat="server">
                                        FECHA DE SOLICITUD***</td>
                                    <td style="height: 39px; width: 235px;" runat="server">
                                        <asp:TextBox ID="txtFechaSolicitud" runat="server"></asp:TextBox><asp:CalendarExtender
                                            ID="txtFechaSolicitud_CalendarExtender" runat="server" Enabled="True" Format="MM/dd/yyyy"
                                            TargetControlID="txtFechaSolicitud">
                                        </asp:CalendarExtender>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaSolicitud"
                                            ErrorMessage="El campo fecha de solicitud es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo-obligatorio">
                                        ESTADO DE LA ORDEN ***</td>
                                    <td class="size-300" style="width: 235px">
                                        <dx:ASPxComboBox ID="ddlEstadosOrden" runat="server" AutoResizeWithContainer="True"
                                            IncrementalFilteringMode="Contains" Theme="PlasticBlue">
                                        </dx:ASPxComboBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo-obligatorio" runat="server">
                                        FECHA DE ENTREGA ***</td>
                                    <td style="height: 39px; width: 235px;" runat="server">
                                        <asp:TextBox ID="txtFechaEntrega" runat="server"></asp:TextBox><asp:CalendarExtender
                                            ID="txtFechaEntrega_CalendarExtender" runat="server" Enabled="True" Format="MM/dd/yyyy"
                                            TargetControlID="txtFechaEntrega">
                                        </asp:CalendarExtender>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaEntrega"
                                            ErrorMessage="EL campo fecha de entrega es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="campo-obligatorio" runat="server">
                                        FECHA DE CARGUE ***</td>
                                    <td style="height: 39px;" runat="server">
                                        <asp:TextBox ID="txtFechaAsignacion" runat="server"></asp:TextBox><asp:CalendarExtender
                                            ID="txtFechaAsignacion_CalendarExtender" runat="server" Enabled="True" Format="MM/dd/yyyy"
                                            TargetControlID="txtFechaAsignacion">
                                        </asp:CalendarExtender>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txtFechaAsignacion"
                                            ErrorMessage="El campo fecha de asignación es obligatorio">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2">
                                        <dx:ASPxButton ID="btnGrabar" runat="server" ClientIDMode="AutoID" Height="27px"
                                            OnClick="btnGrabar_Click" Text="GRABAR" Theme="PlasticBlue" Width="148px">
                                            <ClientSideEvents Click="function(s, e) { Callback.PerformCallback();  LoadingPanel.Show(); }" />
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">
                        <HeaderTemplate>
                            <b>VINES DISPONIBLES</b></HeaderTemplate>
                        <ContentTemplate>
                            <table width="960px">
                                <tr>
                                    <td colspan="2">
                                        <dx:ASPxGridView ID="ASPxGridViewVines" runat="server" AutoGenerateColumns="False"
                                            KeyFieldName="AVI_ID" Theme="PlasticBlue" ClientInstanceName="ASPxGridViewVines">
                                            <Columns>
                                                <dx:GridViewCommandColumn VisibleIndex="0" ShowSelectCheckbox="True" ShowInCustomizationForm="True">
                                                </dx:GridViewCommandColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ID" ReadOnly="True" VisibleIndex="1" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_CLIENTE" VisibleIndex="2" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ORIGEN" VisibleIndex="3" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_DESTINO" VisibleIndex="4" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_CONCESIONARIO" VisibleIndex="5" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_VIN" VisibleIndex="6" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_NoMOTOR" VisibleIndex="7" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_INVENTARIO" VisibleIndex="8" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_DESCRIPCION" VisibleIndex="9" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_COLOR" VisibleIndex="10" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ZONA" VisibleIndex="11" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_SOLICITANTE" VisibleIndex="12" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ALMACEN" VisibleIndex="13" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_TIPO_FACTURACION" VisibleIndex="14" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_NoEQUIPO" VisibleIndex="15" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ZVSK" VisibleIndex="16" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_KMAT" VisibleIndex="17" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_TIPO" VisibleIndex="18" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_TIPO_UNIDAD" VisibleIndex="19" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ANO_MDL" VisibleIndex="20" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_PEDIDO" VisibleIndex="21" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ENTREGA" VisibleIndex="22" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FACTURA" VisibleIndex="23" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FCH_FACT" VisibleIndex="24" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_BL" VisibleIndex="25" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FECHA_DESPACHO_DEALER" VisibleIndex="26"
                                                    ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_DESPACHO" VisibleIndex="27" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FECHA_RECEPCION_DEALER" VisibleIndex="28"
                                                    ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_NOVEDADES_DESTINO" VisibleIndex="29" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_NOVEDADES_ORIGEN" VisibleIndex="30" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_REPORTE_FACTURA" VisibleIndex="31" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_COMENTARIOS" VisibleIndex="32" ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_REPORTADO_EN_DESPACHO" VisibleIndex="33"
                                                    ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_REPORTADO_EN_ENTREGA" VisibleIndex="34"
                                                    ShowInCustomizationForm="True">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowFilterRowMenu="True" />
                                        </dx:ASPxGridView>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="15%">
                                        I
                                    </td>
                                    <td>
                                        &nbsp;<asp:FileUpload ID="fuImportar" runat="server" Visible="False" />
                                        <dx:ASPxButton ID="btnImportarVines" runat="server" ClientIDMode="AutoID" Height="27px"
                                            OnClick="btnImportarVines_Click" Text="Importar" Theme="PlasticBlue" Width="148px"
                                            Visible="False">
                                            <ClientSideEvents Click="function(s, e) { Callback.PerformCallback();  LoadingPanel.Show(); }" />
                                        </dx:ASPxButton>
                                        <asp:HyperLink ID="HyperLink1" runat="server" ClientIDMode="Static" NavigateUrl="~/Archivos/PruebaAutosol.xls"
                                            Visible="False">Descargar Plantilla</asp:HyperLink>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <dx:ASPxButton ID="btnAsociarVines0" runat="server" ClientIDMode="AutoID" Height="27px"
                                            OnClick="btnAsociarVines_Click" Text="GUARDAR" Theme="PlasticBlue" Width="148px">
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel runat="server" HeaderText="TabPanel3" ID="TabPanel3">
                        <HeaderTemplate>
                            <b>VINES ASIGNADOS</b></HeaderTemplate>
                        <ContentTemplate>
                            <table>
                                <tr>
                                    <td>
                                        <dx:ASPxGridView ID="ASPxGridViewVinesAsociados" runat="server" AutoGenerateColumns="False"
                                            KeyFieldName="AVI_ID" Theme="PlasticBlue" Width="950px" ClientInstanceName="ASPxGridViewVinesAsociados"
                                            OnCustomCallback="ASPxGridViewVinesAsociados_CustomCallback" OnRowUpdating="ASPxGridViewVinesAsociados_RowUpdating"
                                            OnRowValidating="ASPxGridViewVinesAsociados_RowValidating">
                                            <Columns>
                                                <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" ShowInCustomizationForm="True">
                                                    <EditButton Visible="True">
                                                    </EditButton>
                                                    <HeaderTemplate>
                    <dx:ASPxCheckBox ID="SelectAllCheckBox" runat="server" ToolTip="Seleccione/Deselecciones todas las filas de  la pagina"
                        ClientSideEvents-CheckedChanged="function(s, e) { ASPxGridViewVinesAsociados.SelectAllRowsOnPage(s.GetChecked()); }" />
                </HeaderTemplate>
                                                </dx:GridViewCommandColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ID" ReadOnly="True" VisibleIndex="1" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_CLIENTE" VisibleIndex="2" Caption="CLIENTE"
                                                    ReadOnly="True" ShowInCustomizationForm="True">
                                                    <PropertiesTextEdit>
                                                        <ReadOnlyStyle BackColor="#66FFCC">
                                                        </ReadOnlyStyle>
                                                    </PropertiesTextEdit>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ORIGEN" VisibleIndex="3" Caption="ORIGEN"
                                                    ReadOnly="True" ShowInCustomizationForm="True">
                                                    <PropertiesTextEdit>
                                                        <ReadOnlyStyle BackColor="#66FFCC">
                                                        </ReadOnlyStyle>
                                                    </PropertiesTextEdit>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_REPORTADO_EN_DESPACHO" VisibleIndex="9"
                                                    ShowInCustomizationForm="True">
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_DESTINO" Caption="CUIDAD DESTINO" VisibleIndex="4"
                                                    ReadOnly="True" Width="250px" ShowInCustomizationForm="True">
                                                    <PropertiesTextEdit>
                                                        <ReadOnlyStyle BackColor="#66FFCC">
                                                        </ReadOnlyStyle>
                                                    </PropertiesTextEdit>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataComboBoxColumn Caption="ORIGEN" FieldName="ACL_ID_ORIGEN" VisibleIndex="5"
                                                    ShowInCustomizationForm="True">
                                                    <PropertiesComboBox DataSourceID="SqlDataSourceClienteOrigen" TextField="Nombre"
                                                        IncrementalFilteringMode="StartsWith" ValueField="ACL_ID_ORIGEN">
                                                    </PropertiesComboBox>
                                                    <EditFormSettings Visible="False" />
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataComboBoxColumn>
                                                <dx:GridViewDataComboBoxColumn Caption="DESTINO" FieldName="ACL_ID_DESTINO" VisibleIndex="6"
                                                    ShowInCustomizationForm="True">
                                                    <PropertiesComboBox DataSourceID="SqlDataSourceClienteDestino" TextField="Nombre"
                                                        IncrementalFilteringMode="StartsWith" ValueField="ACL_ID_DESTINO">
                                                    </PropertiesComboBox>
                                                    <EditFormSettings Visible="False" />
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataComboBoxColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_CONCESIONARIO" VisibleIndex="4" Caption="CONCESIONARIO DESTINO"
                                                    ReadOnly="True" ShowInCustomizationForm="True">
                                                    <PropertiesTextEdit>
                                                        <ReadOnlyStyle BackColor="#66FFCC">
                                                        </ReadOnlyStyle>
                                                    </PropertiesTextEdit>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_REPORTADO_EN_ENTREGA" VisibleIndex="10"
                                                    ShowInCustomizationForm="True">
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_VIN" VisibleIndex="12" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_INVENTARIO" VisibleIndex="13" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_DESCRIPCION" VisibleIndex="14" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_COLOR" VisibleIndex="15" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ZONA" VisibleIndex="16" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_SOLICITANTE" VisibleIndex="17" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ALMACEN" VisibleIndex="18" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_TIPO_FACTURACION" VisibleIndex="19" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_NoEQUIPO" VisibleIndex="20" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ZVSK" VisibleIndex="21" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_KMAT" VisibleIndex="22" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_TIPO" VisibleIndex="23" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_TIPO_UNIDAD" VisibleIndex="24" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ANO_MDL" VisibleIndex="25" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_PEDIDO" VisibleIndex="26" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_ENTREGA" VisibleIndex="27" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FACTURA" VisibleIndex="28" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FCH_FACT" VisibleIndex="29" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_BL" VisibleIndex="30" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FECHA_DESPACHO_DEALER" VisibleIndex="31"
                                                    ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_DESPACHO" VisibleIndex="11" ShowInCustomizationForm="True">
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_FECHA_RECEPCION_DEALER" VisibleIndex="32"
                                                    ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataMemoColumn FieldName="AVI_NOVEDADES_DESTINO" VisibleIndex="8" ShowInCustomizationForm="True">
                                                    <PropertiesMemoEdit Height="100px">
                                                    </PropertiesMemoEdit>
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataMemoColumn>
                                                <dx:GridViewDataMemoColumn FieldName="AVI_NOVEDADES_ORIGEN" VisibleIndex="7" ShowInCustomizationForm="True">
                                                    <PropertiesMemoEdit Height="100px">
                                                    </PropertiesMemoEdit>
                                                    <EditCellStyle BackColor="#0099CC">
                                                    </EditCellStyle>
                                                    <CellStyle BackColor="#0099CC">
                                                    </CellStyle>
                                                </dx:GridViewDataMemoColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_REPORTE_FACTURA" VisibleIndex="33" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_COMENTARIOS" VisibleIndex="34" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="AVI_NoMOTOR" VisibleIndex="35" ShowInCustomizationForm="True">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            <SettingsEditing Mode="PopupEditForm" />
                                            <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowTitlePanel="True" ShowFilterRowMenu="True" />
                                            <SettingsText Title="VINES ASOCIADOS" />
                                            <SettingsPopup>
                                                <EditForm AllowResize="True" Width="800px" />
                                            </SettingsPopup>
                                        </dx:ASPxGridView>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <dx:ASPxButton ID="btnLiberarVines" runat="server" ClientIDMode="AutoID" Height="27px"
                                            Text="LIBERAR VINES" Theme="PlasticBlue" Width="148px" OnClick="btnLiberarVines_Click">
                                        </dx:ASPxButton>
                                        <asp:SqlDataSource ID="SqlDataSourceClienteDestino" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
                                            SelectCommand="SELECT        AUT_CLIENTES.ACL_ID AS ACL_ID_DESTINO, 
BAS_ZONAS_GEOGRAFICAS.ZON_NOMBRE AS Municipio, 
BAS_ZONAS_GEOGRAFICAS_1.ZON_NOMBRE AS Departamento,
AUT_CLIENT.ACT_NOMBRE + ' ' + BAS_ZONAS_GEOGRAFICAS.ZON_NOMBRE + ' ' + AUT_CLIENTES.ACL_RAZON_SOCIAL AS Nombre
FROM            AUT_CLIENTES INNER JOIN
                         BAS_ZONAS_GEOGRAFICAS ON AUT_CLIENTES.ZON_ID = BAS_ZONAS_GEOGRAFICAS.ZON_ID INNER JOIN
                         BAS_ZONAS_GEOGRAFICAS AS BAS_ZONAS_GEOGRAFICAS_1 ON 
                         BAS_ZONAS_GEOGRAFICAS.ZON_PADRE_ID = BAS_ZONAS_GEOGRAFICAS_1.ZON_ID INNER JOIN
                         AUT_CLIENT ON AUT_CLIENTES.ACT_ID = AUT_CLIENT.ACT_ID"></asp:SqlDataSource>
                                        <asp:SqlDataSource ID="SqlDataSourceClienteOrigen" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
                                            SelectCommand="SELECT dbo.AUT_CLIENTES.ACL_ID AS ACL_ID_ORIGEN, 
dbo.BAS_ZONAS_GEOGRAFICAS.ZON_NOMBRE AS Municipio, 
BAS_ZONAS_GEOGRAFICAS_1.ZON_NOMBRE AS Departamento,  
AUT_CLIENT.ACT_NOMBRE + ' ' + dbo.BAS_ZONAS_GEOGRAFICAS.ZON_NOMBRE+ ' ' + dbo.AUT_CLIENTES.ACL_RAZON_SOCIAL AS Nombre 

FROM            AUT_CLIENTES INNER JOIN
                         BAS_ZONAS_GEOGRAFICAS ON AUT_CLIENTES.ZON_ID = BAS_ZONAS_GEOGRAFICAS.ZON_ID INNER JOIN
                         BAS_ZONAS_GEOGRAFICAS AS BAS_ZONAS_GEOGRAFICAS_1 ON 
                         BAS_ZONAS_GEOGRAFICAS.ZON_PADRE_ID = BAS_ZONAS_GEOGRAFICAS_1.ZON_ID INNER JOIN
                         AUT_CLIENT ON AUT_CLIENTES.ACT_ID = AUT_CLIENT.ACT_ID"></asp:SqlDataSource>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel ID="TabPanel4" runat="server" Visible="false" HeaderText="TabPanel4">
                        <HeaderTemplate>
                            <b>REMESAS</b></HeaderTemplate>
                        <ContentTemplate>
                            <asp:Button ID="btnRemesas" runat="server" OnClick="btnRemesas_Click" Text="Mostrar Remesas" />
                            <dx:ASPxGridView ID="ASPxGridRemesas" runat="server" AutoGenerateColumns="False"
                                ClientInstanceName="ASPxGridViewVinesAsociados" KeyFieldName="ACL_ID" Theme="PlasticBlue"
                                Width="950px" OnRowCommand="ASPxGridRemesas_RowCommand">
                                <Columns>
                                    <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" ShowInCustomizationForm="True">
                                    </dx:GridViewCommandColumn>
                                    <dx:GridViewDataTextColumn Caption="CLIENTE" FieldName="ACL_RAZON_SOCIAL" VisibleIndex="2"
                                        ShowInCustomizationForm="True">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn Caption="ID" FieldName="ACL_ID" ReadOnly="True" VisibleIndex="1"
                                        ShowInCustomizationForm="True">
                                        <EditFormSettings Visible="False" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataHyperLinkColumn Caption="NUMERO REMESA" VisibleIndex="3" ShowInCustomizationForm="True">
                                        <DataItemTemplate>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <asp:LinkButton CommandName="cmdGenerar" Visible='<%# Convert.ToDecimal(Eval("AVI_NUMERO_REMESA")) == 0 ? true :  false%>'
                                                            ID="LinkButton1" runat="server">Generar Número Remesa</asp:LinkButton>
                                                        <asp:Label ID="lblNumeroRemesa" runat="server" Text='<%# Eval("AVI_NUMERO_REMESA")%>' />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:LinkButton CommandName="cmdEnviarCargue" ID="LinkButton2" runat="server">Enviar Cargue GM</asp:LinkButton>
                                                        Numero Transaccion
                                                        <%# Eval("AVI_NUMERO_TRANSACCION_CARGUE")%>
                                                    </td>
                                                </tr>
                                            </table>
                                        </DataItemTemplate>
                                    </dx:GridViewDataHyperLinkColumn>
                                </Columns>
                                <SettingsEditing Mode="PopupEditForm" />
                                <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowTitlePanel="True" />
                                <SettingsText Title="VINES ASOCIADOS" />
                                <SettingsPopup>
                                    <EditForm AllowResize="True" Width="800px" />
                                </SettingsPopup>
                            </dx:ASPxGridView>
                            <asp:SqlDataSource ID="SqlDataSourceRemesas" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
                                SelectCommand="SELECT DISTINCT dbo.AUT_CLIENTES.ACL_RAZON_SOCIAL, dbo.AUT_CLIENTES.ACL_ID,dbo.AUT_VINES.AVI_NUMERO_REMESA
 FROM dbo.AUT_ORDEN_SALIDA INNER JOIN dbo.AUT_ORDEN_SALIDA_AUT_VIN ON dbo.AUT_ORDEN_SALIDA.AOS_ID = dbo.AUT_ORDEN_SALIDA_AUT_VIN.AOS_ID INNER JOIN dbo.AUT_VINES 
 ON dbo.AUT_ORDEN_SALIDA_AUT_VIN.AVI_ID = dbo.AUT_VINES.AVI_ID INNER JOIN dbo.AUT_CLIENTES ON dbo.AUT_VINES.ACL_ID_DESTINO = dbo.AUT_CLIENTES.ACL_ID WHERE (dbo.AUT_ORDEN_SALIDA.AOS_ID = @AOS_ID)">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="lblNumeroOrdenCargue" Name="AOS_ID" PropertyName="Text"
                                        Type="Decimal" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            <dx:ASPxButton ID="btnImprimirRemesa" runat="server" ClientIDMode="AutoID" Height="27px"
                                Text="IMPRIMIR REMESA" Theme="PlasticBlue" Width="148px" OnClick="btnImprimirRemesa_Click">
                            </dx:ASPxButton>
                        </ContentTemplate>
                    </asp:TabPanel>
                </asp:TabContainer>
            </td>
        </tr>
    </table>
</asp:Content>
